package com.wyl.mybatis.demo;

import cn.hutool.json.JSONUtil;
import com.wyl.mybatis.config.SqlSessionFactoryConfig;
import com.wyl.mybatis.entity.FullCity;
import com.wyl.mybatis.factory.CustomObjectFactory;
import com.wyl.mybatis.mapper.FullCityMapper;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

/**
 * @Description
 * @Author WuYiLong
 * @Date 2024/3/14 11:57
 */
public class ObjectFactoryDemo {

    private final static Logger log = LoggerFactory.getLogger(ObjectFactoryDemo.class);

    public static void main(String[] args) throws IOException {

        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryConfig.buildSqlSessionFactory();
        try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
            FullCityMapper mapper = sqlSession.getMapper(FullCityMapper.class);
//            FullCity fullCity = mapper.selectByName("广东省");
            List<FullCity> fullCities = mapper.selectFullCityLikeName("广东");
            for (FullCity fullCity : fullCities) {
                log.info("区域的名称：{}",fullCity.getName());
            }

        }



    }
}
